package com.springboot.hui.controller;

import com.springboot.hui.mode.StudentRq;
import com.springboot.hui.mode.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@Api(value = "FastJson测试", tags = {"测试接口"})
@RestController
@RequestMapping("fastjsontestswagger")
public class FastJsonControllerTestSwagger {

    @ApiOperation("获取用户信息")
    @ApiImplicitParam(name = "name", value = "用户名", dataType = "string", paramType = "query")
    @GetMapping("/test/{name}")
    public User test(@PathVariable("name") String name) {
        User user = new User();

        user.setId(1);
        user.setUsername(name);
        user.setPassword("jack123");
        user.setBirthday(new Date());

        return user;
    }
@ApiOperation("学生请求")
    @PostMapping("test/student")
    public String teststudent(@RequestBody @ApiParam(name="用户对象",value="传入json格式",required=true) StudentRq studentRq) {

        return "this is success";
    }
}